package com.gugee.tiktok.common.model.dal.hashtag;


import com.gugee.tiktok.common.model.dto.Aweme4HashtagDto;
import com.gugee.tiktok.common.model.mysql.Hashtag;
import com.gugee.tiktok.data.common.msg.HashtagMessage;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface HashtagRepository extends CrudRepository<Hashtag,Long>, HashtagExtRepository {

//    Optional<Hashtag> findByHid(long hid);
    List<Hashtag> findByHidIn(List<Long> hids);

    @Query("SELECT id,hid FROM hashtag  order by id  limit :start,:records")
    List<HashtagMessage> getHashtagsByPages(long start, long records);

    @Query("SELECT o_text_extra  FROM aweme order by score desc LIMIT  :start,:records")
    List<Aweme4HashtagDto> getHashtagsTopOrderByScore(long start, long records);
}
